/**
 * View package.
 */
package fr.umlv.m2.ig.view;

import java.awt.Shape;

/**
 * This class defines a tuple (shape, station, line).
 * 
 * @author Gambouele Bertrand.
 * @author Viravout Alexandre.
 */
class StationShape {

	/**
	 * Station shape
	 */
	private final Shape shape;
	
	/**
	 * Line name;
	 */
	private final String line;
	
	/**
	 * Station name.
	 */
	private final String station;

	/**
	 * Creates a new {@code StationShape} object with specified parameters.
	 * 
	 * @param shape the station shape.
	 * @param station the station name.
	 * @param line the line name.
	 */
	StationShape(final Shape shape, final String station, final String line) {
		this.shape = shape;
		this.station = station;
		this.line = line;
	}

	/**
	 * Gets the station shape.
	 * 
	 * @return station shape.
	 */
	Shape getShape() {
		return this.shape;
	}

	/**
	 * Gets the line name.
	 * 
	 * @return line name.
	 */
	String getLine() {
		return this.line;
	}

	/**
	 * Gets the station name.
	 * 
	 * @return the station name.
	 */
	String getStation() {
		return this.station;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		
		if (!(obj instanceof StationShape)) {
			return false;
		}
		
		StationShape ss = (StationShape)obj;
		
		return this.station.equals(ss.getStation()) && this.line.equals(ss.getLine());
	}
	
	@Override
	public int hashCode() {
		return this.station.hashCode() ^ this.line.hashCode();
	}
}